<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<!-- 引入 -->
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
</head>
<body>

<button id="btn">测试</button>
<button>测试</button>
<button>测试</button>
<button>测试</button>
<button>测试</button>
<button>测试</button>

<script type="text/javascript">
	// $("#btn").text("确定"); // innerText
	var b = document.getElementById("btn"); // DOM 对象
	var c = $(b);
	c.text("取消");   // jQuery 对象
	console.info(c)
	// jQuery 对象 ==> DOM
	var d = c.get(0);// 获取到DOM对象
	console.info(d);
	
	var e = c[0];
	console.info(e);
	
	
	// 获取多个元素
	// jQuery  ==》 $
	var f = jQuery("button");
	console.info(f)
	console.info(f.length)
	
	f.text("你好");
	
	// each

    $.each([52, 97], function(index, value) {
        alert(index + ': ' + value);
    });
	
	

	

</script>





<div></div>
<p></p>
<span></span>
<script>

// grep 过滤
$(function () { 
	var arr = [ 1, 9, 3, 8, 6, 1, 5, 9, 4, 7, 3, 8, 6, 9, 1];
	$( "div" ).text( arr.join( ", " ) );
	//过滤元素
	

	arr = jQuery.grep(arr, function( n, i ) {
		return ( n !== 5 && i > 4 );
	});
	$( "p" ).text( arr.join( ", " ) ); 
	
	arr = jQuery.grep(arr, function( a ) {
		return a !== 9;
	});
	$( "span" ).text( arr.join( ", " ) );
})
</script>








</body>
</html>